<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="net.groupme.gui.rendering.constants.RENDERING_CONSTANTS"%>
<%@page import="net.groupme.search.SEARCH_CONFIGURATION"%>
<%@page import="net.groupme.model.Group"%>
<%@page import="net.groupme.model.Resource"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.lang.Integer"%>
<%@page import="net.groupme.model.Tag"%>
<%@page import="net.groupme.user.UserManager"%>
<%@page import="net.groupme.model.User"%>
<%@page import="net.groupme.model.ObjectFactory"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@page import="java.util.ListIterator"%>
<%@page import="java.util.Collection"%>
<%@page import="java.util.HashMap"%>
<%@page import="net.groupme.model.MODEL_CONSTANTS"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<!-- meta tags, link to css:  -->
	<%@ include file="./jsp-includes/mymetaheader.jsp" %>
	
	<!--  Ajax-Includes -->
    <script type='text/javascript' src='/GroupMe/dwr/interface/DWRUserManager.js'></script>
    <script type='text/javascript' src='/GroupMe/dwr/interface/DWRSearchManager.js'></script>
    <script type='text/javascript' src='/GroupMe/dwr/engine.js'></script>
    <script type='text/javascript' src='/GroupMe/dwr/util.js'></script>

	<!-- Prototype-Include -->
	<script type='text/javascript' src='./scriptaculous/prototype.js'></script>
	
	<title>GroupMe! - The Social Semantic Web [Search]</title>
	
	<script type="text/javascript" language="javascript"><!--
	//<![CDATA[//>
	
	/**
	 * Visualize a tag cloud.
	 */
	
	//init stuff:
	
	
	function init(number) {
		  //DWRUtil.useLoadingMessage();
		  
		  DWRSearchManager.getTagCloud(null, null, false, showTagCloud);
		  $('tagCloud_content').innerHTML += "<img src=\"<%= request.getContextPath() + RENDERING_CONSTANTS.RELATIVE_PATH_OF_AJAX_LOADING_IMAGE %>\"/> " +
											 "<small><i>refreshing tag cloud</i></small>";
		  
	}
	
	function showTagCloud(tagCloud){
		
	 	$('tagCloud_content').innerHTML = tagCloud.html;
	 }
	
	//<!]]>
	//-->
	</script>
</head>

<body onload="init()">
	<!-- title image, logo:  -->
	<div id="groupme_header">
		<%@ include file="./jsp-includes/groupme_header.jsp" %>
	</div>
	
	<!-- Menu: -->
	<div id="menu">
		<%@ include file="./jsp-includes/groupme_menu.jsp" %>
	</div>
	<!-- content and sidebar -->
	<!-- Content: -->
	<div id="mycontent">
		<div id="main_home">
			<div class="ro_bw">
				<div class="lo_bw">
					<div class="ru_bw">
						<div class="lu_bw">
							<div class="content_header" style="padding-top: 2px; font-size: small; color: #006699;">
								Search for Groups/Resources:
							</div>
							<div id="main_home_content">
	 							<%@ include file="./jsp-includes/groupme_search_main.jsp" %>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div id="sidebar_right">
			<div id="tagCloud">
				<div class="ro_bw">
					<div class="lo_bw">
						<div class="ru_bw">
							<div class="lu_bw">
								<div class="content_header" style="padding-top: 2px; font-size: small; color: #006699;">
								most popular tags:
								</div>
								<div id="tagCloud_content" style="font-size: small;">
									
									<!-- first do caching: -->
									<c:choose>
										<c:when test="${searchManager.cachedTagCloud != null}">
											<c:out value="${searchManager.cachedTagCloud.html}" escapeXml="false"/><br/>
										</c:when>
									<c:otherwise>
										no cached tag cloud
									</c:otherwise>
									</c:choose>								
								</div>
							</div>	
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div id="footer">
		<%@ include file="./jsp-includes/footer.jsp" %>
	</div>
</body>
</html>